package com.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerController {

    //private static final String REST_URL_PROVIDER_PREFIX = "http://localhost:8001";
    private static final String REST_URL_PROVIDER_PREFIX = "http://MICROSERVICE-CLOUD-PROVIDER";



    @Autowired
    private RestTemplate template;

    @GetMapping("/info")
    public String getProviderInfo(){
        return template.getForObject(REST_URL_PROVIDER_PREFIX+"/info",String.class);
    }

    @GetMapping("/timeout")
    public String testTimeout(){
        return template.getForObject(REST_URL_PROVIDER_PREFIX+"/testTimeout",String.class);
    }

}
